﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace IceDog.Lib.Event.Timer
{
    public class Display
    {
        private static int Counter = 0;
        private static string DisplayString = "This string will appar one letter at a time.\n";

        private static void WriteChar(object sender,ElapsedEventArgs args)
        {
            Console.Write(DisplayString[Counter++ % DisplayString.Length]);
        }

        public static void Run()
        {
            var timer = new System.Timers.Timer(10)
            {
                Enabled = true
            };
            //timer.Elapsed += WriteChar;
            timer.Elapsed += new ElapsedEventHandler(WriteChar);
            timer.Start();
            Console.ReadKey();
        }
    }
}
